package com.tledu.spring05.service;

import com.tledu.spring05.annotation.Log;
import com.tledu.spring05.mapper.UserMapper;
import com.tledu.spring05.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Antg
 * @date 2021/8/9  19:34
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    @Log(type = "findAll", desc = "查询所有")
    public List<User> findAll() {
        return userMapper.findAll();
    }

    @Override
    @Log(type = "findById", desc = "根据用户id查用户")
    public User findById(Integer id) {
        return userMapper.findById(id);
    }

    @Override
    @Log(type = "add", desc = "添加用户")
    public int add(User user) {
        return userMapper.add(user);
    }

    @Override
    @Log(type = "edit", desc = "编辑用户")
    public int edit(User user) {
        return userMapper.edit(user);
    }

    @Override
    @Log(type = "del", desc = "删除用户")
    public int del(int id) {
        return userMapper.del(id);
    }
}
